import request from '@/utils/request'

// 查询运营指标监控列表
export function listDealOperationalIndicators(query) {
  return request({
    url: '/indicators/dealOperationalIndicators/list',
    method: 'get',
    params: query
  })
}

// 查询运营指标监控详细
export function getDealOperationalIndicators(id) {
  return request({
    url: '/indicators/dealOperationalIndicators/' + id,
    method: 'get'
  })
}

// 保存运营指标监控
export function saveDealOperationalIndicators(data) {
  return request({
    url: '/indicators/dealOperationalIndicators/save',
    method: 'post',
    data: data
  })
}

// 删除运营指标监控
export function delDealOperationalIndicators(id) {
  return request({
    url: '/indicators/dealOperationalIndicators/' + id,
    method: 'delete'
  })
}

// 导出运营指标监控
export function exportDealOperationalIndicators(query) {
  return request({
    url: '/indicators/dealOperationalIndicators/export',
    method: 'get',
    params: query
  })
}

// 根据指标年度获取指标明细信息
export function getIndicatorsMaintainByIndicatorYear(param) {
  return request({
    url: '/indicators/dealOperationalIndicators/getIndicatorsMaintainByIndicatorYear',
    method: 'get',
    params: param
  })
}

// 分组指标名称list
export function getGroupByIndicatorName(params) {
  return request({
    url: '/indicators/dealOperationalIndicators/getGroupByIndicatorName',
    method: 'get',
    params: params
  })
}

// 校验当前项目运营指标 指标年份和季度是否已存在数据
export async function checkForIndicatorYearAndQuarterRepeated(params) {
  return await request({
    url: '/indicators/dealOperationalIndicators/checkForIndicatorYearAndQuarterRepeated',
    method: 'get',
    params: params
  }).then(response => {
    return response.code === 200 && response.data
  })
}
